<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <title>电子书内容管理</title>
    <link rel="stylesheet" href="css/admin.css" />
    <link rel="stylesheet" href="css/quill.snow.css" />
    <link rel="stylesheet" href="css/all.min.css" />
    <script src="js/jspdf.umd.min.js"></script>
    <script src="js/html2canvas.min.js"></script>
  </head>
  <body>
    <div class="admin-container">
      <div class="admin-header">
        <h1>电子书内容管理</h1>
        <div class="header-actions">
          <div class="cover-upload">
            <label for="coverImage" class="secondary-btn">
              设置封面图
            </label>
            <input type="file" id="coverImage" accept="image/*" style="display: none;">
          </div>
          <button id="saveBtn" class="primary-btn">保存内容</button>
          <button id="exportBtn" class="secondary-btn">导出电子书</button>
          <button id="exportDataBtn" class="secondary-btn">导出数据</button>
          <button id="importBtn" class="secondary-btn">导入数据</button>
        </div>
      </div>

      <!-- 编辑器容器 -->
      <div class="editor-container">
        <div id="bookEditor"></div>
      </div>

      <!-- 添加一个隐藏的文件输入框 -->
      <input type="file" id="importFile" accept=".json" style="display: none" />
    </div>
    <script src="js/quill.js"></script>
    <script src="js/jszip.min.js"></script>
    <script src="js/editor.js"></script>
    <script src="js/admin.js"></script>
    <script>
      window.addEventListener("DOMContentLoaded", () => {
        if (typeof Quill === "undefined") {
          console.error("Quill not loaded!");
          return;
        }

        try {
          window.bookAdmin = new BookAdmin();
        } catch (error) {
          console.error("初始化失败:", error);
        }
      });
    </script>
  </body>
</html>
